]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Don't move focusWindow back down on window grab
authorJonas Dreßler <verdre@v0yd.nl>
Sat, 20 Feb 2021 12:57:51 +0000 (13:57 +0100)
committerMarge Bot <marge-bot@gnome.org>
Sat, 13 Mar 2021 18:28:15 +0000 (18:28 +0000)
I suggested it myself when reviewing
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1668, so
here I am reverting that again...

The difference between calling _setFocusWindow(null) and simply
unsetting the focusWindow is that the former animates the window back to
its position before we shifted it up, while the latter simply "lets go
of the window".

In this case we actually want the latter because after the user grabbed
the window, we obviously should not animate it away right underneath the
users pointer/finger.

To ensure the same mistake doesn't happen again, add a small comment
explaining why this code is as it is.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1760>

js/ui/keyboard.js

index 43b4e5d27dc01c4fc2fcd1b64d5299f9d825415b..023b0484f432703e4d10ef0c48432f022ee833bc 100644 (file)
@@ -1275,7 +1275,11 @@ var Keyboard = GObject.registerClass({
         this._connectSignal(this._focusTracker, 'position-changed',
             this._onFocusPositionChanged.bind(this));
         this._connectSignal(this._focusTracker, 'window-grabbed', () => {
-            this._setFocusWindow(null);
+            // Don't use _setFocusWindow() here because that would move the
+            // window while the user has grabbed it. Instead we simply "let go"
+            // of the window.
+            this._focusWindow = null;
+            this._focusWindowStartY = null;
         });
         // Valid only for X11
         if (!Meta.is_wayland_compositor()) {